package gridsoft.sapi.config;

import com.zaxxer.hikari.HikariDataSource;
import org.noear.redisx.RedisClient;
import org.noear.solon.Solon;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;

import javax.sql.DataSource;

@Configuration
public class DsConfigure {
    // 同时支持 name 和 类型 两种方式注入（注入时没有name，即为按类型注入）
    @Bean(name = "db1", typed = true)
    public DataSource db1(@Inject("${db.db1}") HikariDataSource ds) {
        String schema = Solon.cfg().get("db.db1.schema");
        ds.setSchema(schema);
        return ds;
    }

}

